import { GTextFormat } from "../../common/GTextFormat";
import { FilterConst } from "../../component/gconst/FilterConst";
import { LayerManager } from "./LayerManager";
import { HTMLUtil } from "../../../com/gengine/utils/HTMLUtil";
type int = number;
//class MsgGuideTipsImpl
    
    export  class MsgGuideTipsImpl /* flash.display.Sprite */
    {
        constructor()
        {
            
            cacheAsBitmap = true;
            mouseEnabled = false;
            mouseChildren = false;
            tabEnabled = false;
            return;
        }

        /* internal  */initText(): void
        {
            this._text = new Object /* flash.text.TextField */();
            this._text.defaultTextFormat = new GTextFormat("", 14, 16160847, true, null, null, null, null, flash.text.TextFormatAlign.LEFT);
            this._text.multiline = true;
            this._text.wordWrap = true;
            this._text.width = 200;
            this._text.x = 10;
            this._text.y = 10;
            this._text.filters = [FilterConst.nameGlowFilter];
            this._text.mouseEnabled = false;
            addChild(this._text);
            return;
        }

        /* internal  */drawLineBox(): void
        {
            graphics.clear();
            graphics.lineStyle(1, 16160847);
            graphics.beginFill(0, 1);
            graphics.drawRect(0, 0, this._text.textWidth + 20, this._text.textHeight + 20);
            graphics.endFill();
            return;
        }

        /* internal  */onTimeOut(): void
        {
            this.hide();
            return;
        }

        public show(arg1: string, arg2: int, arg3: int, arg4: Object /* flash.display.DisplayObjectContainer */=null, arg5: int=0): void
        {
            if (!this._text) 
            {
                this.initText();
            }
            if (arg4 == null) 
            {
                arg4 = LayerManager.guideLayer;
            }
            this._text.htmlText = HTMLUtil.addColor(arg1, "#F6984F");
            this.drawLineBox();
            this.x = arg2;
            this.y = arg3;
            arg4.addChild(this);
            flash.utils.clearTimeout(this._timeKey);
            if (arg5 > 0) 
            {
                this._timeKey = flash.utils.setTimeout(this.onTimeOut, arg5);
            }
            return;
        }

        public hide(): void
        {
            graphics.clear();
            flash.utils.clearTimeout(this._timeKey);
            if (this._text) 
            {
                this._text.text = "";
            }
            if (this.parent) 
            {
                this.parent.removeChild(this);
            }
            return;
        }

        /* internal */ /* var */_text: Object /* flash.text.TextField */;

        /* internal */ /* var */_timeKey: uint;
    }
